﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ImportFromExcel.ascx.vb" Inherits="Control_MaSoThue_ImportFromExcel" %>
<script type="text/javascript">
    function ajaxJquery() {
        $(function () {
            // File Upload
            $('#file_upload_content').uploadify({
                'uploader': '<%=ResolveUrl("~/Uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/Uploadify/UploadDocumentFile.ashx")%>',
                'cancelImg': '<%=ResolveUrl("~/Uploadify/cancel.png")%>',
                'auto': false,
                'multi': false,
                'fileExt': '*.xls;*.xlsx;',
                'fileDesc': 'Word file document (.xls, .xlsx)',
                'fileDataName': 'fileAttach',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onSelect': function () {
                    $('#divError').hide();
                },
                'onComplete': function (event, ID, fileObj, response, data) {
                    // append data from responser in hidden field
                    $("#txtFileNameUpload").val(response);
                    $("#<%=btnUpload.ClientID%>").click();
                }
            });

            //show danh sách CMND trùng
            $('#A1').click(function (event) {
                $('#CMND').slideToggle(500)
            });
            //show danh sách MST trùng
            $('#B1').click(function (event) {
                $('#MST').slideToggle(500)
            });
        });
    }

    function showHide(isShow) {
        if (isShow == 1)
            $('#divError').show();
        else $('#divError').hide();
    }
    function UploadFile() {
        var _hasFile = $('.uploadifyQueueItem').size();
        if (_hasFile == 0) {
            Alertbox('Hãy chọn 1 file [*.xls | xlsx]');
        } else {
            $('html, body').animate({ scrollTop: 0 }, 800);
            $("#txtFileNameUpload").val('');
            $('#file_upload_content').uploadifyUpload();
        }
        return false;
    }

</script>
<asp:UpdatePanel ID="uplImportFromExcelMST" runat="server">
    <ContentTemplate>
        <div class="content_porletform">
            <div class="HeadTitle">
                <h3>IMPORT FROM EXCEL FILE
                </h3>
            </div>
            <div class="box_contentform">
                <div class="box_scroll_grid">
                    <div class="DivRequired">
                        <span class="fieldRequired">&nbsp;</span>Note: Định dạng file upload excel (.xls
                        | xlsx)
                    </div>
                    <div class="panel-group">
                        <div class="panel-body">
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="lblFullname" CssClass="TextLabel" runat="server" Text="File cập nhật:" /><span
                                        class="fieldRequired">&nbsp;</span>
                                </div>
                                <div class="DivTextBox">
                                    <input id="file_upload_content" name="file_upload_content" type="file" />
                                </div>
                            </div>
                            <div style="clear: both; height: 10px">
                            </div>
                            <%--======================================================--%>
                            <%--<div class="DivRow">
                                <div class="DivLabel">
                                   Loại</div>
                                <div class="DivTextBox">
                                   <asp:DropDownList ID="ddlLoai" runat="server">
                                    <asp:ListItem Value="0">Cấp mới</asp:ListItem>
                                    <asp:ListItem Value="1">Cấp đổi</asp:ListItem>
                                </asp:DropDownList>
                                </div>
                                </div>--%>
                            <%--======================================================--%>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    &nbsp;&nbsp;&nbsp;
                                </div>
                                <div class="DivTextBox">
                                    <asp:Button ID="btnUpLoadFile" runat="server" CssClass="btn" ClientIDMode="Static"
                                        Text=" Upload Data " OnClientClick="return UploadFile();" />
                                    <asp:Button ID="btnUpload" runat="server" CssClass="btn" Text=" Upload Data " OnClientClick="return ClickUpdate();" Style="display: none" />
                                </div>
                            </div>
                            <div class="DivRow">
                                <asp:Label runat="server" ID="lblDong" />
                            </div>
                            <div class="DivRow" id="divError" style="display: none">
                                <span class="TextLabel">
                                    <asp:Label ID="lblCMND" runat="server" /></span>
                                <legend class="SubjectTitle">
                                    <img alt="" src="../../images/arrow_showless.gif" id="img1" />
                                    <a id="A1" href="#">
                                        <asp:Literal ID="ltrDanhSachCMND" runat="server" /></a>&nbsp;&nbsp;</legend>
                                <div id="CMND" style="display: none">
                                    <asp:Literal runat="server" ID="ltrExistsCMND" />
                                </div>
                                <br></br>
                                <span class="TextLabel">
                                    <asp:Label ID="lblMST" runat="server" /></span>
                                <legend class="SubjectTitle">
                                    <img alt="" src="../../images/arrow_showless.gif" id="img1" />
                                    <a id="B1" href="#">
                                        <asp:Literal ID="ltrDanhSachMST" runat="server" /></a>&nbsp;&nbsp;</legend>
                                <div id="MST" style="display: none">
                                    <asp:Literal runat="server" ID="ltrMSTUpdate" />
                                </div>
                                <br></br>
                            </div>
                        </div>
                    </div>
                    <div style="display: none">
                        <asp:HiddenField runat="server" ID="txtFileNameUpload" Value="" ClientIDMode="Static" />
                    </div>
                </div>
            </div>
        </div>
        </div> </div>
    </ContentTemplate>
</asp:UpdatePanel>
